<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh_CN">
<ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-compact nav-child-indent" data-widget="treeview" role="menu" data-accordion="false" th:fragment="menu(tpl)">
    <!-- 使用 .nav-icon 类添加图标，
         或使用 font-awesome 或其他任何图标字体库 -->
    <li class="nav-item has-treeview">
        <a href="#" class="nav-link" th:href="@{/}" th:cellpadding="${tpl}=='/'?'active':''">
            <i class="nav-icon fas fa-tachometer-alt"></i>
            <p>
                首页
            </p>
        </a>

    </li>
    <li class="nav-item has-treeview">
        <a href="#" class="nav-link" th:href="@{'/admin/space/list'}" th:cellpadding="${tpl}=='/admin/space/list'?'active':''">
            <i class="nav-icon fas fa-th"></i>
            <p>
                博客空间
            </p>
        </a>
    </li>
    <li class="nav-item has-treeview">
        <a href="#" class="nav-link">
            <i class="nav-icon fas fa-th"></i>
            <p>
                内容
                <i class="right fas fa-angle-left"></i>
            </p>
        </a>
        <ul class="nav nav-treeview">
            <li class="nav-item">
                <a href="#" class="nav-link"  th:href="@{'/admin/blogPost/list'}" th:classappend="${tpl}=='/admin/blogPost/list'?'active':''">
                    <i class="far fa-circle nav-icon"></i>
                    <p>文章</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{'/admin/category/list'}" class="nav-link" th:classappend="${tpl}=='/admin/category/list'?'active':''">
                    <i class="far fa-circle nav-icon"></i>
                    <p th:utext="类别">分类设置</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" class="nav-link">
                    <i class="far fa-circle nav-icon"></i>
                    <p th:utext="附件">附件</p>
                </a>
            </li>
        </ul>
    </li>
    <li class="nav-item has-treeview">
        <a href="#" class="nav-link">
            <i class="nav-icon fas fa-th"></i>
            <p>
                小程序
                <i class="right fas fa-angle-left"></i>
            </p>
        </a>
        <ul class="nav nav-treeview">
            <li class="nav-item">
                <a href="#" class="nav-link"  th:href="@{'/admin/miniApp/list/1'}" th:classappend="${tpl}=='/admin/miniApp/app'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>小程序设置</p>
                </a>
            </li>
        </ul>
        <ul class="nav nav-treeview">
            <li class="nav-item">
                <a href="#" class="nav-link"  th:href="@{'/admin/miniApp/wx-list-news/1/1'}" th:classappend="${tpl}=='/admin/miniApp/wx-list-news'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>小程序内容管理</p>
                </a>
            </li>
        </ul>
    </li>
    <li class="nav-item has-treeview">
        <a href="#" class="nav-link">
            <i class="nav-icon fas fa-sim-card"></i>
            <p>
                系统设置
                <i class="right fas fa-angle-left"></i>
            </p>
        </a>
        <ul class="nav nav-treeview">
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/mail}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/mail'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>邮件推送</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/baidu}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/baidu'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>百度推送</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/baiduyun}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/baiduyun'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>百度云设置</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/site}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/site'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>站点设置</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/register}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/register'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>注册设置</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="#" th:href="@{/admin/setting/edit/sensitiveword}" class="nav-link"  th:classappend="${tpl}=='/admin/setting/sensitiveword'?'active':''">
                    <i class="fab fa-medapps nav-icon"></i>
                    <p>敏感关键词</p>
                </a>
            </li>
        </ul>
    </li>
</ul>
<!-- 分页 -->
<ul class="pagination pagination-sm m-0 float-right" th:fragment="pager( pageIndex,pageTotal,urlPrefix )" th:if="${pageTotal gt 0}">
    <li class="page-item" th:classappend="${pageIndex==1}?'disabled':''">
        <a href="#" class="page-link" th:href="@{${urlPrefix}(page=${pageTotal})}">«</a></li>
    <th:block th:each="index:${#numbers.sequence(1, pageTotal)}">
        <li class="page-item" th:classappend="${pageIndex==index}?'active':''" th:if="${(pageIndex-10/2) le 0 and index le 10} or (${(pageIndex-10/2) gt 0} and ${index ge pageIndex-10/2+1 and index le pageIndex-10/2+10} and ${pageTotal-pageIndex ge 10/2}) or  ${pageTotal-pageIndex lt 10/2 and index gt pageTotal-10}">
            <a href="#" class="page-link" th:href="@{${urlPrefix}(page=${index})}"th:text="${index}">1</a>
        </li>
    </th:block>
    <li class="page-item" th:classappend="${pageIndex==pageTotal}?'disabled':''">
        <a href="#" class="page-link"  th:href="@{${urlPrefix}(page=${pageTotal})}">»</a>
    </li>
</ul>
<div  th:fragment="form(form,action)"  xmlns:th="http://www.w3.org/1999/html">
    <div class="card card-default">
    <div class="card-header">
        <h3 class="card-title" th:utext="${form.title}" th:if="${form.title}">标题</h3>
    </div>
    <form class="form-horizontal form-padding ajaxform" th:action="${action}" method="get" th:method="${form.method}">
        <div class="card-body">
            <div th:each="item:${form.formItems}">
                <div class="form-group" th:classappend="${item.hide}?'d-none':''"  th:if="${item.element eq'input'}">
                    <label  th:utext="${item.getTitle()}" th:for="${item.fieldName}" for="input">Field Name</label>
                    <input type="text" id="input" th:name="${item.fieldName}" th:id="${item.fieldName}" class="form-control" th:placeholder="${item.fieldName}" th:value="${(item.value==null or item.value=='null')?'':item.value}" th:if="${item.fieldName ne 'settingName' && item.className ne 'Boolean'} " />
                    <input type="checkbox" id="id-state-input" th:name="${item.fieldName}" th:id="${item.fieldName}" class="toggle-switch" value="TRUE"  th:checked="${item.value eq 'TRUE' }" th:if="${item.fieldName ne 'settingName' && item.className eq'Boolean'} "/>
                    <label for="id-state-input" th:for="${item.fieldName}" th:if="${item.fieldName ne 'settingName' && item.className eq'Boolean'} "></label>
                    <p class="form-control-static" th:utext="${item.value}" th:if="${item.fieldName eq 'settingName'}">Text</p>
                    <input type="hidden" th:name="${item.fieldName}" th:value="${item.value}" value="TRUE"  th:if="${item.fieldName eq 'settingName'} "/>
                    <small class="help-block" th:utext="${item.tip}" th:if="${item.tip}">This is tip</small>
                </div>
                <div class="form-group" th:classappend="${item.hide}?'d-none':''"  th:if="${item.element eq'date'}">
                    <label  th:utext="${item.getTitle()}" th:for="${item.fieldName}" for="inputDate">Field Name</label>
                    <input type="text" id="inputDate" th:name="${item.fieldName}" th:id="${item.fieldName}" class="form-control datetimepicker-input" th:placeholder="${item.fieldName}" th:value="${(item.value==null or item.value=='null')?'':item.value}"  th:data-useformat="${item.format}"/>
                    <small class="help-block" th:utext="${item.tip}" th:if="${item.tip}">This is tip</small>
                </div>

                <div class="form-group" th:classappend="${item.hide}?'hide':''" th:if="${item.element eq 'select'}">
                    <label  th:utext="${item.getTitle()}" th:for="${item.fieldName}" for="input">Field Name</label>
                    <select class="form-control select2bs4" th:name="${item.fieldName}" th:id="${item.fieldName}" id="cat-selector" th:multiple="${item.multiple}"  th:title="${item.title}" style="width: 100%">
                        <option value="value" th:each="option:${item.formOption}" th:value="${option.id}"
                                th:text="${option.text}" th:selected="${item.listKey!=null and item.listKey.contains(option.id)}">option
                        </option>
                    </select>
                    <small class="help-block" th:utext="${item.tip}" th:if="${item.tip}">This is tip</small>
                </div>
                <div class="form-group" th:classappend="${item.hide}?'hide':''"  th:if="${item.element eq 'textarea'}">
                    <label th:utext="${item.getTitle()}" th:for="${item.fieldName}" for="input">Field Name</label>
                    <textarea th:name="${item.fieldName}" th:id="${item.fieldName}" th:utext="${item.value}" style="width:100%;min-height: 450px;" th:class="${item.htmlEditor && !item.htmlEditUpload} ?'htmlEditor': ${item.htmlEditUpload?'htmlEditUpload':''}"></textarea>
                    <small class="help-block" th:utext="${item.tip}" th:if="${item.tip}">This is tip</small>
                </div>
            </div>
        </div>
        <div class="card-footer" th:if="!${form.hideSubmit}">
            <button id="submitbtn" type="submit" class="btn btn-primary">保存</button>
        </div>

    </form>
    </div>
</div>

</html>